package com.example.spring.cloud.consumer.feign;

import com.example.spring.cloud.bean.User;
import com.example.spring.cloud.common.Result;
import com.example.spring.cloud.consumer.feign.hystrix.UserFeignHystrix;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@Component
@FeignClient(value = "CLOUD-PROVIDER", fallback = UserFeignHystrix.class)
public interface UserFeign {

    @PostMapping("/user/add")
    Result<User> add(@RequestBody User user);

    @GetMapping("/user/get/{id}")
    Result<User> get(@PathVariable("id") Integer id);

}
